package com.meusconcursos.dataupdate.tables;

import com.meusconcursos.MeusConcursosActivity;
import com.meusconcursos.dataupdate.Record;
import com.meusconcursos.dataupdate.Table;

import android.content.ContentValues;
import android.util.Log;

public class TableCargo extends Table {

	public TableCargo() {
		super();

	}

	@Override
	public String getTableName() {
		return "cargo";
	}

	@Override
	public String getScriptTableCreate() {
		return getHeaderScriptTableCreate() 
				+ "([_id] INTEGER NOT NULL PRIMARY KEY, "
				+ "[id_edital] INTEGER NOT NULL, "
				+ "[id_nivel_cargo] INTEGER NOT NULL, "
				+ "[nome] TEXT NOT NULL)";
	}

	@Override
	public Record newRecordInstance(String[] values) {

		ContentValues cv = null;

		cv = new ContentValues();
		int indiceValue = 0;
		
		cv.put("_id", new Integer(values[indiceValue++]));
		cv.put("id_edital", new Integer(values[indiceValue++]));
		cv.put("id_nivel_cargo", new Integer(values[indiceValue++]));
		cv.put("nome", values[indiceValue++]);
		
		Log.i(MeusConcursosActivity.DEBUG_TAG, "Criando Registro CARGO: " + cv.toString());		

		return new Record(cv);

	}

}
